package com.swa99ylum.pxp.a.a003;

import org.apache.poi.xssf.usermodel.XSSFCell;

import com.lsy.poi.cell.extractor.CellExtractor;
import com.lsy.poi.exception.cell.ExtractorException;

public class IntegerCellExtractor extends CellExtractor {//TODO: 抽象类 CellExtractor，是否可以实现 单例模式（把 Extractor 视为一个 工具，里面不包含 任何状态 ）

	@Override
	public Integer doExtract(XSSFCell cell) throws ExtractorException {
		Integer cellValue;
		
		try {
			cellValue = (int) cell.getNumericCellValue();
		} catch (IllegalStateException e) {
			throw new ExtractorException(cell, "按 Integer 类型");
		}
		
		return cellValue;
	}
	
}
